<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
		<title>Insert title here</title>
	</head>
	<body>
		<ui:composition template="/view/templates/layout.xhtml">
			<ui:define name="content">
				<p>
					<h:link value="#{appResources['label.link.News']}" outcome="newsList" />
					&gt;&gt;
					#{appResources['label.newslist.title']}<br/>
				</p>
				<h:form onsubmit="return deleteFromList()">
					<ui:repeat var="news" value="#{newsBean.newsList}">
						<ul>
							<li class="news">
								<p class="date">
									<h:outputText value="#{news.date}">
										<f:convertDateTime pattern="#{appResources['format.date']}" />
									</h:outputText>
								</p>
								<p class="title">
									 #{news.title}
								</p>
								<p class="brief">
									#{news.brief}
								</p>
								<h:selectBooleanCheckbox styleClass="checkBox" value="#{newsBean.selectedNews[news.id]}" />
								<p class="edit">
									<h:commandLink value="#{appResources['label.newslist.link.edit']}" action="#{newsBean.edit}">
										<f:setPropertyActionListener target="#{newsBean.currentNewsId}" value="#{news.id}" />
									</h:commandLink>
								</p>
								<p class="view"> 
									<h:commandLink value="#{appResources['label.newslist.link.view']}" action="#{newsBean.view}">
										<f:setPropertyActionListener target="#{newsBean.currentNewsId}" value="#{news.id}" />
									</h:commandLink>
								</p>				
							</li>
						</ul>
					</ui:repeat>
					<h:commandButton rendered="#{!empty newsBean.newsList}" styleClass="deleteButton" value="#{appResources['label.newslist.button.delete']}" action="#{newsBean.delete}"/>
				</h:form>
			</ui:define>
		</ui:composition>
	</body>
</html>